﻿using System.ComponentModel;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using SlideView.Library;

namespace DepSoft.Mobile.WP8.FollwIt.View
{
    public partial class MainPage : PhoneApplicationPage
    {
        private SlideApplicationFrame _rootFrame = (SlideApplicationFrame)App.RootFrame;

        // Constructor
        public MainPage()
        {
            InitializeComponent();
            _rootFrame.IsSlideEnabled = true;
            _rootFrame.IsHeaderVisible = true;
            //this.LoadingProgressBar.Foreground = new SolidColorBrush(Colors.Orange);
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            while (NavigationService.RemoveBackEntry() != null);

            _rootFrame.Title = "follw.it";
        }

        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            if (_rootFrame.ContentVisible != ContentVisible.Center)
            {
                _rootFrame.ShowCenterContent();
                e.Cancel = true;
            }

            base.OnBackKeyPress(e);
        }
    }
}